//
//  ViewController.swift
//  iostest
//
//  Created by jin on 2024/7/29.
//

import UIKit

class ViewController: UIViewController {
    
    @IBOutlet weak var titleView: UILabel!
    
    @IBOutlet weak var clickBtn: UIButton!
    
    @IBOutlet weak var userNameTf: UITextField!
    
    @IBOutlet weak var iconIV: UIImageView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        
        titleView.text = "标题：IOS学习"
        
        clickBtn.addTarget(self, action: #selector(butClickTow(_:)), for: .touchUpInside)
        
        iconIV.image = UIImage(named: "kuwo")
    }

    @IBAction func butClick(_ sender: UIButton) {
        sender.setTitle("我被点击了", for: .normal)
        print("我被点击了")
    }
    
    @objc func butClickTow(_ sender: UIButton) {
        print("我被点击了222")
    }
    @IBAction func toSecondPage(_ sender: UIButton) {
       let controller =  storyboard!.instantiateViewController(withIdentifier: "secondPage")
        /// 设置对话框全屏
        controller.modalPresentationStyle = .fullScreen
        ///以弹出的形式跳转到第二个页面
        present(controller, animated: true)
    }
    @IBAction func getUserName(_ sender: UIButton) {
        let username = userNameTf.text!
        if username.isEmpty{
            print("用户名为空")
            return
        }
        print(username)
    }
}

